package com.lagou.dao;

import com.lagou.model.entity.OrderDO;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;


public interface OrderDao extends JpaRepository<OrderDO, Integer> {

    @Transactional
    @Modifying
    @Query(value = "update lagou_order set order_status = ?3" +
            " where id = ?1 and order_status = ?2", nativeQuery = true)
    int updateOrderStatusByStatus(Integer orderId, Integer originalStatus, Integer orderStatus);

}
